public class Test {
    public static void main(String[] args) {
        //
    }
}

class Solution {
    public int peakIndexInMountainArray(int[] arr) {
        int left = 1;
        int right = arr.length - 2;//题目说了，一定是山峰数组，那么绝对不会是arr的边界



        while (left < right) {
            int mid = left + (right - left + 1) / 2;
            if (arr[mid] > arr[mid - 1]) {
                left = mid;
            }else if(arr[mid] < arr[mid - 1]){
                right = mid - 1;
            }
        }

        return left;

    }
}
